#使用while 输出效果1+2+3+4
j = 1

while j <= 9:
    i = 1

    while i <= j:
        print("{}*{}={:<4}".format(i,j,i*j),end="")
        i += 1
    print("")
    j += 1

print("="*80)
print("\r\n")
#===================================================
j = 9

while (10-j) <= 9:
    i = 1

    while i <= j:
        print("{}*{}={:<4}".format(i,j,i*j),end="")
        i += 1
    print("")
    j -= 1

print("="*80)
print("\r\n") 
#===================================================
j = 1

while j <= 9:
    i = j
    k = 1
    
    while k <= (9-j):
        print(end="        ")
        k += 1

    while i >= 1:
        print("{}*{}={:<4}".format(i,j,i*j),end="")
        i -= 1
    print("")
    j += 1
    
print("="*80)
print("\r\n")
#===================================================
j = 9

while j >= 1:
    i = j
    k = 1
    
    while k <= (9-j):
        print(end="        ")
        k += 1

    while i >= 1:
        print("{}*{}={:<4}".format(i,j,i*j),end="")
        i -= 1
    print("")
    j -= 1
    
print("="*80)
print("\r\n")


#使用for...in输出效果1+2+3+4

i = 0
j = 0

for j in range(1,10):
    for i in range(1,j+1):
        print("{}*{}={:<4}".format(i,j,i*j),end="")
    print("")
print("="*80)
print("")
print("\r\n")
#===================================================   
i = 0
j = 0

for j in range(9,0,-1):
    for i in range(1,j+1):
        print("{}*{}={:<4}".format(i,j,i*j),end="")
    print("")
    
print("="*80)
print("\r\n")
#===================================================
i = 0
j = 0
k = 0

for j in range(1,10):
    for k in range(1,10-j):
        print(end="        ")
    for i in range(j,0,-1):
        print("{}*{}={:<4}".format(i,j,i*j),end="")
    print("")
    
print("="*80)
print("\r\n")
#===================================================
i = 0
j = 0
k = 0

for j in range(9,0,-1):
    for k in range(1,10-j):
        print(end="        ")
    for i in range(j,0,-1):
        print("{}*{}={:<4}".format(i,j,i*j),end="")
    print("")
    
print("="*80)
print("\r\n")


